package dxbridge.model;

import java.util.List;


import org.dom4j.Document;

import dxbridge.model.impl.Table;

public interface IDataSet {

    /**
     * Check if two DataSet contains tables with same name. In most cases only
     * if two DataSet generated from one mapping file can return same.
     * 
     * @param ds
     * @return Is two DataSet contains the same tables.
     */
    public abstract boolean containsSameTables(IDataSet ds);

    /**
     * Get how many records are there in this whole DataSet.
     * 
     * @return Number of records.
     */
    public abstract int getNumOfRecords();

    /**
     * Search table with given name in dataSet, if found, return that table, if
     * not found, return null.
     * 
     * @param tableName
     *            The table name.
     * @return The table instance, or null if no table found.
     */
    public abstract ITable getTable(String tableName);

    /**
     * Get {@link Table}contains in this DataSet.
     * 
     * @return List of Table.
     */
    public abstract List<ITable> getTables();

    /**
     * 
     * Set {@linkITable}contains in this DataSet.
     * 
     * @param tables
     *            List of Table to be set into this DataSet.
     */
    public abstract void setTables(List<ITable> tables);

    /**
     * To add a table in the List of Tables in DataSet.
     * 
     * @param table
     *            The table instance to be added into this dataSet.
     */
    public abstract void addTable(ITable table);

    /**
     * Get a Dom4j Document with root element <xmlroot>, and contains all the
     * records in this DataSet, with no structure, that is "Flat"
     * 
     * @return Flat records Document
     */
    public abstract Document getFlatDocument();

    /**
     * For test usage.
     */
    public abstract void printTest();

    /**
     * Get name of this DataSet, it should be exactly same with the name of the
     * xml file with out ".xml" surfix.
     * 
     * @return Name of this DataSet.
     */
    public abstract String getDataSetName();

    /**
     * Set name of this DataSet.
     * 
     * @param dataSetName
     */
    public abstract void setDataSetName(String dataSetName);

}